using Microsoft.VisualStudio.TestTools.UnitTesting;

using LyyCommon.Test.Models;

namespace LyyCommon.Test
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            string[] words = { "zhangsan", "lisi" };
            foreach (var item in words)
            {
                var result = LyyCommon.Utils.SetFirstToUpper(item);

                string rst = item[0].ToString().ToUpper() + (item.Length > 1 ? item.Substring(1) : "")+ " NETCOREAPP30";

                Assert.AreEqual(result, rst);
            }
        }

        [TestMethod]
        public void TestJson()
        {
            Persons Person = new Persons()
            {
                Id = 1,
                Name = "z",
                Age = 18
            };
            var json = LyyCommon.Helper.JsonHelper.ObjectToJSON(Person);
            var myjson = Newtonsoft.Json.JsonConvert.SerializeObject(Person);
            Assert.IsNotNull(json);
            Assert.AreEqual(json, myjson);
        }
    }
}
